import React from 'react';
import { MOBILE_REG } from 'utils/consts';
import { Link } from 'react-router-dom';
import {
  Form,
  Input,
  Button,
} from 'antd';
import LogoHeader from '../../../components/Header/LogoHeader';

import styles from './index.module.less';

const FormItem = Form.Item;
class Message extends React.Component {
  state = {
    confirmDirty: false,
    autoCompleteResult: [],
  };

  handleSubmit = e => {
    e.preventDefault();
    this.props.form.validateFieldsAndScroll((err, values) => {
      if (!err) {
        console.log('Received values of form: ', values);
      }
    });
  }
  render() {
    const { getFieldDecorator } = this.props.form;

    const rightContent = (
      <div className={styles.menuBox}>
        <Link className={styles.menuItem} to='/'>首页</Link>
        <Link className={styles.menuItem} to='/login'>登录</Link>
        <Link className={styles.menuItem} to='/register'>注册</Link>
        <Link className={styles.menuItem} to='/'>帮助中心</Link>
      </div>
    );

    return (
      <React.Fragment>
        <LogoHeader moduleName='重置密码' rightContent={rightContent} />
        <div className={styles.content}>
          <div className={styles.box}>
            <div className={styles.text1}><Link to="/message">选择其他验证方式></Link></div>
            <div className={styles.text2}>通过已绑定邮箱辅助重置密码</div>
            <div>
              <Form onSubmit={this.handleSubmit}>
                <FormItem>
                  {getFieldDecorator('email', {
                    rules: [{
                      type: 'email', message: 'The input is not valid E-mail!',
                    }, {
                      required: true, message: '请输入已绑定邮箱号',
                    }],
                  })(
                    <Input placeholder='请输入已绑定邮箱号' style={{ width: '372px', height: '40px' }}/>
                  )}
                </FormItem>
                <FormItem>
                  <Button type="primary" htmlType="submit" className={styles.submitBtn}>验证</Button>
                </FormItem>
              </Form>
            </div>
            <div className={styles.text3}>
              <span className={styles.s1}>遇到麻烦？</span>
              <span>请致电客服协助您400-681-6018(周一至周日 9:30-17:00)</span>
            </div>
          </div>
        </div>
      </React.Fragment>
    );
  }
}

export default Form.create()(Message);
